package com.qqtech.qquan.send.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.model.PageKit;
import com.qqtech.core.frame.model.PageOrder;
import com.qqtech.core.frame.service.BaseServiceImpl;

import com.qqtech.qquan.send.dao.SendDeliveryOrderItemDao;
import com.qqtech.qquan.send.model.*;

import jersey.repackaged.com.google.common.collect.Lists;

@Service
public class SendDeliveryOrderItemServiceImpl extends BaseServiceImpl<SendDeliveryOrderItem>
		implements SendDeliveryOrderItemService {
	public static final Logger log = LoggerFactory.getLogger(SendDeliveryOrderItemServiceImpl.class);
	
	@Resource
	private SendDeliveryOrderItemDao sendDeliveryOrderItemDao;

	@Override
	protected BaseDao<SendDeliveryOrderItem> getBaseDao() {
		return sendDeliveryOrderItemDao;
	}
	
	@Override
	public List<SendDeliveryOrderItemVo> getDeliveryOrderItemList(Integer deliveryId){
		if(deliveryId==null){
			return Lists.newArrayList();
		}
		SendDeliveryOrderItemQuery itemQ =  new SendDeliveryOrderItemQuery(); 
		itemQ.setDeliveryId(deliveryId);
		Pageable pageKit = new PageKit(1, Integer.MAX_VALUE,new PageOrder(Direction.ASC, "orderItemId"));
		List<SendDeliveryOrderItemVo> deliveryOrderItemList = this.queryList(itemQ, pageKit);
		return deliveryOrderItemList;
	}
}